package com.liehacker.android.mapservice;

import com.liehacker.android.R;

import android.app.Activity;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;

public class C24_LastKnown extends Activity{
	
	LocationManager	mLocMan;
	TextView 		mtvResult;
	String			mstrProvider;
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);	
		setContentView(R.layout.c24_lastknown);
		
		mtvResult = (TextView)findViewById(R.id.tvResult);
		mLocMan = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
		
		mstrProvider = mLocMan.getBestProvider(new Criteria(), true);
		Location location = mLocMan.getLastKnownLocation(mstrProvider);
		
		String strTemp = "";
		if( location == null )
			strTemp = "최근 위치 : 알수 없음";
		else {
			strTemp = String.format("최근 위치 : \n위도:%f\n경도:%f\n고도:%f",  
					location.getLatitude(), location.getLongitude(), location.getAltitude());
		}
			
		mtvResult.setText(strTemp);
		
	}
}
